<?php

/**
 * AnoModelo filter form base class.
 *
 * @package    toyomotor
 * @subpackage filter
 * @author     Ing. Roberto Hernández De La Luz at Netosfera
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseAnoModeloFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_ano'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ano'), 'add_empty' => true)),
      'id_modelo'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Modelo'), 'add_empty' => true)),
      'tipo_vehiculo' => new sfWidgetFormChoice(array('choices' => array('' => '', 'Comercial' => 'Comercial', 'Carga' => 'Carga', 'Pasajeros' => 'Pasajeros'))),
    ));

    $this->setValidators(array(
      'id_ano'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Ano'), 'column' => 'id_ano')),
      'id_modelo'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Modelo'), 'column' => 'id_modelo')),
      'tipo_vehiculo' => new sfValidatorChoice(array('required' => false, 'choices' => array('Comercial' => 'Comercial', 'Carga' => 'Carga', 'Pasajeros' => 'Pasajeros'))),
    ));

    $this->widgetSchema->setNameFormat('ano_modelo_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AnoModelo';
  }

  public function getFields()
  {
    return array(
      'id_ano_modelo' => 'Number',
      'id_ano'        => 'ForeignKey',
      'id_modelo'     => 'ForeignKey',
      'tipo_vehiculo' => 'Enum',
    );
  }
}
